package org.dtrd.config.wechat.config;

import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
import com.wechat.pay.contrib.apache.httpclient.exception.HttpCodeException;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import org.apache.commons.compress.archivers.sevenz.CLI;
import org.dtrd.config.wechat.entity.bean.officialaccount.WechatOfficialAccount;
import org.dtrd.config.wechat.entity.bean.pay.WechatPayConfig;
import org.springframework.core.io.ClassPathResource;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;

/**
 * @author 萧
 * @date:2021-09-23 11:06 下午
 **/
public class WechatUtil {

    private static String clientId;
    private static String accessKeySecret;

    private static WechatOfficialAccount nitang;

    public static void initNiTangConfig(String appId, String appSecret, String token) {
        nitang = new WechatOfficialAccount(appId, appSecret, token);
    }

    public static WechatOfficialAccount getNiTangConfig() {
        return nitang;
    }

    public static String getClientId() {
        return clientId;
    }

    public static void setClientId(String clientId) {
        WechatUtil.clientId = clientId;
    }

    public static String getAccessKeySecret() {
        return accessKeySecret;
    }

    public static void setAccessKeySecret(String accessKeySecret) {
        WechatUtil.accessKeySecret = accessKeySecret;
    }

    public static void setNitang(WechatOfficialAccount nitang) {
        WechatUtil.nitang = nitang;
    }

}
